/**                                
 * Copyright ® 2013 东软集团股份有限公司
 * 版权所有。     
 */ 

package practice3.persistence.tx;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import practice3.persistence.MyAction;
import practice3.persistence.User;

/**
 * <p>Class       : practice2.TheMain
 * <p>Descdription: 类功能描述
 * @author  顾力行-gulx@neusoft.com
 * @version 1.0.0
 */
public class SpringTxMain {
	public static void main(String args[]) throws Exception {

		String url = MyAction.class.getResource("").getPath();
		ApplicationContext ctx = new FileSystemXmlApplicationContext(url + "/tx/txApplicationContext.xml");
		MyAction action = (MyAction) ctx.getBean("myAction");
		User u = new User();
//		u.setId(UUID.randomUUID().toString());
		u.setName("Mikasa Ackerman");
//		action.txAdd(u);//操作失败，数据回滚
		action.execute();//操作成功
//		System.out.println("用户："+action.getUser(u.getId()).getName());
	}
}
